package com.loma.common.base

import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.RecyclerView
import com.alibaba.android.arouter.launcher.ARouter
import com.drake.brv.PageRefreshLayout
import com.loma.common.R
import com.loma.common.utils.ext.singleClick
import kotlinx.android.synthetic.main.base_list_binding_activity.*

/***
 * 使用databinding的包含列表的activity抽像类
 */
abstract class BaseListActivity<VM :  ViewModelBase > : AppCompatActivity() {
    val vm by lazy { ViewModelProvider(this).get(vmClass) }
    abstract val vmClass: Class<VM>


    /***
     * 数据适配器
     */


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        ARouter.getInstance().inject(this)
        ivBack.singleClick { onBackPressed()  }
        tvTitle.setText(title)
        observe()

    }

    abstract fun observe()







}
